package fr.vvins.core.services;

import java.util.List;

import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;

import fr.vvins.core.biz.exception.BizException;
import fr.vvins.core.biz.group.dto.GroupDto;
import fr.vvins.core.biz.group.dto.GroupDtoInfo;
import fr.vvins.core.common.TechnicalException;
import fr.vvins.core.order.entity.PaymentMethod;

/**
 * Group interface groups all methods related group management.
 * @author fguay
 *
 */
public interface GroupService {

	/**
	 * Create a new shipping community group.<BR>
	 * Method : PUT<BR>
	 * Path : "/group/create?token={token}"<BR>
	 * Consumes : MediaType.APPLICATION_JSON<BR>
	 * Produces : MediaType.APPLICATION_JSON<BR>
	 * 
	 * @param token : user authentication token
	 * @param group : group data object
	 * @throws BizException
	 * @throws TechnicalException
	 */
	@PUT
	@Path("/create")
	@Consumes(MediaType.APPLICATION_JSON)
	@Produces(MediaType.APPLICATION_JSON)
	public GroupDto createGroup(@QueryParam("token") String token, GroupDto group) throws BizException, TechnicalException; 
	
	/**
	 * Get detail of shipping community group by id.<BR>
	 * Method : GET<BR>
	 * Path : "/group/detail/{id}"<BR>
	 * Produces : MediaType.APPLICATION_JSON<BR>
	 * 
	 * @param id of target group
	 * @return group data object
	 * @throws BizException
	 * @throws TechnicalException
	 */
	@GET
	@Path("/detail/{id}")
	@Produces(MediaType.APPLICATION_JSON)
	public GroupDto getGroup(@PathParam("id")String id) throws BizException, TechnicalException;
	
	/**
	 * Get detail of shipping community group by id.<BR>
	 * Method : GET<BR>
	 * Path : "/group/detail/{id}"<BR>
	 * Produces : MediaType.APPLICATION_JSON<BR>
	 * 
	 * @param id of target group
	 * @return group data object
	 * @throws BizException
	 * @throws TechnicalException
	 */
	@GET
	@Path("/vigneron/{id}")
	@Produces(MediaType.APPLICATION_JSON)
	public List<GroupDtoInfo> getGroupByVigneron(@PathParam("id")String id) throws BizException, TechnicalException;
	
	
	/**
	 * Get detail of shipping community group by id.<BR>
	 * Method : GET<BR>
	 * Path : "/group/detail/{id}"<BR>
	 * Produces : MediaType.APPLICATION_JSON<BR>
	 * 
	 * @param id of target group
	 * @return group data object
	 * @throws BizException
	 * @throws TechnicalException
	 */
	@GET
	@Path("/creator/{id}")
	@Produces(MediaType.APPLICATION_JSON)
	public List<GroupDtoInfo> getGroupByCreator(@PathParam("id")String id) throws BizException, TechnicalException;
	
	/**
	 * Get detail of shipping community group by id.<BR>
	 * Method : GET<BR>
	 * Path : "/group/detail/{id}"<BR>
	 * Produces : MediaType.APPLICATION_JSON<BR>
	 * 
	 * @param id of target group
	 * @return group data object
	 * @throws BizException
	 * @throws TechnicalException
	 */
	@GET
	@Path("/user/{id}")
	@Produces(MediaType.APPLICATION_JSON)
	public List<GroupDtoInfo> getGroupByUser(@PathParam("id")String id) throws BizException, TechnicalException;
	
	
	/**
	 * Get all shipping community groups.<BR>
	 * Method : GET<BR>
	 * Path : "/group/all"<BR>
	 * Produces : MediaType.APPLICATION_JSON<BR>
	 * 
	 * @return list of groups
	 * @throws BizException
	 * @throws TechnicalException
	 */
	@GET
	@Path("/all")
	@Produces(MediaType.APPLICATION_JSON)
	public List<GroupDtoInfo> getGroups() throws BizException, TechnicalException;
	
	/**
	 * Get a shippingMethod from group id.<BR>
	 * Method : GET<BR>
	 * Path : "/paymentMethod/{id}"<BR>
	 * Produces : MediaType.APPLICATION_JSON<BR>
	 * 
	 * @param id of target group
	 * @return a payment method object of order service.
	 * @throws BizException
	 * @throws TechnicalException
	 */
	@GET
	@Path("/paymentMethod/{id}")
	@Produces(MediaType.APPLICATION_JSON)
	public PaymentMethod getPaymentMethodGroup(@PathParam("id")String id) throws BizException, TechnicalException;
	
}
